﻿@model Backend.JYD.Model.Task.IntentEntryInfo
@using Backend.JYD.Model
@using Backend.JYD.Model.Cust
@using Backend.JYD.Web.Common
@using Backend.JYD.Business
@{
    ViewBag.Title = "意向修改";
    Layout = "~/Views/Shared/_LayoutWin.cshtml";
    var empInfo = ViewBag.LoginEmpInfo as EmpInfo;
}
@using (Ajax.BeginForm("Edit", new AjaxOptions() { OnSuccess = "aftersave" }))
{
    <div class="ui_pop_body" style="width: 550px; height: 580px;">
    <div  style="width:500px;height:auto;">
        <fieldset>
            <legend>客户信息</legend>
            <ul class="edit-ul">
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.CustNo) : </span>
                    <span class="s02">@Html.DisplayFor(model => model.CustNo)</span>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.CustName) : </span>
                    <span class="s02">@Html.DisplayFor(model => model.CustName)</span>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.PaperType) : </span>
                    <span class="s02"><label>@(Model == null ? string.Empty : CodeManager.GetCodeNameByTypeCode(CodeManager.PaperType, Model.PaperType))</label></span>
                </li>
                 <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.PaperNo) : </span>
                    <span class="s02">@Html.DisplayFor(model => model.PaperNo)</span>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.Phone) : </span>
                    <span class="s02">@Html.TextBoxFor(model => model.Phone, new { @readOnly = "readOnly" })
                        <label for="ephone"><input type="checkbox" id="ephone" name="ephone" onclick="editPhone()"/>修改客户电话</label>
                    </span>
                </li>
                 <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.ChanelType) : </span>
                    <span class="s02">@(Model == null ? string.Empty : CodeManager.GetCodeNameByTypeCode(CodeManager.CustChanelType, Model.ChanelType.ToString()))</span>
            </ul>
        </fieldset>

        <fieldset>
            <legend>融资意向信息</legend>
            <ul class="edit-ul">
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.LoanMoney) : </span>
                    <span class="s02">@Html.EditorFor(model => model.LoanMoney)</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.LoanMoney)</i>
                </li>
               <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.Term) : </span>
                    <span class="s02">@Html.EditorFor(model => model.Term)</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.Term)</i>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.Rate) : </span>
                    <span class="s02">@Html.EditorFor(model => model.Rate)</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.Rate)</i>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.Purpose) : </span>
                    <span class="s02">@Html.EditorFor(model => model.Purpose)</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.Purpose)</i>
                </li>

                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.Guarantee) : </span>
                    <span class="s02">
                    @foreach (var item in JydHtmlHelper.ConvertItemFormCodeInfo(false, CodeManager.YesOrNo, Model == null ? string.Empty : (Model.Guarantee.HasValue && Model.Guarantee.Value ? "1" : "0")))
                    {
                        <label>@Html.RadioButton("Guarantee", item.Value, item.Selected, new { @id = "Guarantee" + item.Value })@item.Text</label>
                    }</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.Guarantee)</i>
                </li>
                <li class="li01">
                    <span class="s01">@Html.LabelFor(model => model.RepaymentType) : </span>
                    <span class="s02">@Html.DropDownListFor(model => model.RepaymentType, JydHtmlHelper.ConvertItemFormCodeInfo(true, CodeManager.RepaymentType, Model == null ? string.Empty : (Model.RepaymentType.HasValue ? Model.RepaymentType.Value.ToString() : "0")))</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.RepaymentType)</i>
                </li>
               <li class="li02">
                    <span class="s01">@Html.LabelFor(model => model.Remark) : </span>
                    <span class="s02">@Html.TextAreaFor(model => model.Remark, new { @row = "2", @class = "input-text" })</span>
                    <i class="i01">@Html.ValidationMessageFor(model => model.Remark)</i>
                </li>
            </ul>
        </fieldset>            
    </div>
    <input type="submit" value="保存" onclick="return check(1);" />
    <input type="submit" value="保存并提交" onclick="return check(2);" />
    <input type="button" value="取消" onclick="closeWin()" />
    <input type="hidden" value="0" name="subtype" id="subtype"/>
    @Html.HiddenFor(model => model.IntentId)
</div>

<script src="@Url.Content("~/skin/js/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function aftersave(data) {
        if (data.code) {
            closeWinAndReload();
        }
        else {
            alert(data.msg);
        }
    }
    function editPhone() {
        if ($('#ephone').attr('checked') == "checked") {
            $("#Phone").removeAttr("readonly");
        }
        else {
            $("#Phone").attr("readonly", "readonly");
        }
    }
    function check(type) {
        $('#subtype').val(type);

    }
</script>
}
